package com.compty.paint.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.InitializingBean;

import com.compty.core.framework.context.spring.SpringContextHolder;
import com.compty.core.utils.CommonsUtil;
import com.compty.paint.domain.CatalogType;
import com.compty.paint.manager.CatalogTypeManager;

/**
 * @Todo:常量文件
 * @author: zhuqh
 * @CreateTime:2011-6-9 上午09:25:32
 */
public class Constants implements InitializingBean{
	
	public static final String Userinfo = "userinfo";
	
	public static final String CustomerInfo = "customerInfo";
	
	public static final String SuperAdminstrator = "test";
	
	public static final String MenuMap = "menuMap";
	
	public static final String RegisterInformation = "register_information";
	
	public static final String PassWord_Original = "PassWord_Original"; //原始密码
	
	public static final String ArticleFlag = "article";
	
	public static final String AdvertiseFlag = "advertise";
	
	public static final String zhengshuFlag = "zhengshu";
	
	public static final String BackgroundFlag = "background";
	
	public static final String AuctionFlag = "auction";
	
	public static final String ExhibitionFlag = "exhibition";
	
	public static final String GenerateHtml_Output_Directory = CommonsUtil.getPropertyValue("conf/conf.properties", "output_freemarker");
	
	public static boolean Auto_Audit =  Boolean.parseBoolean(CommonsUtil.getPropertyValue("conf/conf.properties", "painting_audit"));//作品审核模式
	
	public static boolean Member_Audit =  Boolean.parseBoolean(CommonsUtil.getPropertyValue("conf/conf.properties", "member_audit"));//会员审核模式
	
	public static String Image_generate_path =  CommonsUtil.getPropertyValue("conf/conf.properties", "image_generate_path");//图片生成路径
	
	public static String Image_upload_path =  CommonsUtil.getPropertyValue("conf/conf.properties", "image_upload_path");//图片上传路径
	
	public static String IMAGE_SERVER =  CommonsUtil.getPropertyValue("conf/conf.properties", "IMAGE_SERVER");//图片服务器url
	
	public static final String paintingIdListInSession = "paintingIdListInSession";
	
	public static final String CatalogType_Youhua = "youhua";
	
	public static final String CatalogType_Guohua = "guohua";
	
	public static final String CIYI = "ciyi";
	
	public static final String Audit_State_Init ="auditing";  //初始化审核状态：审核中
	
	public static final String Audit_State_Pass ="pass";  //审核状态：通过
	
	public static final String Audit_State_Overrule ="overrule";  //审核状态:驳回
	
	public static final String Upload_State_Init ="normal";  //上传状态:正常
	
	public static final String Upload_State_Hidden ="hidden";  //上传状态：隐藏
	
	public static final String Upload_State_Delete ="deleted";  //上传状态：删除
	
	public static final String User_State_Init ="init";  //用户审核状态:待审
	
	public static final String User_State_Normal ="normal";  //用户审核状态:正常
	
	public static final String User_State_Overrule ="overrule";  //用户审核状态:未通过
	
	public static final String User_State_locked ="locked";  //用户审核状态:锁定
	
	public static final String User_State_hidden ="hidden";  //用户审核状态:隐藏
	
	public static Map<String,String> advertisementMap = new HashMap<String, String>();

	@Override
	public void afterPropertiesSet() throws Exception {
		advertisementMap.put("1", "首页");
		advertisementMap.put("2", "瓷艺");
		advertisementMap.put("3", "绘画");
		CatalogTypeManager catalogTypeManager = SpringContextHolder.getBean("catalogTypeManager");
		List<CatalogType> catalogTypeList = catalogTypeManager.getAll();
		for (CatalogType catalogType : catalogTypeList) {
			if( catalogType.getId() != 1L && catalogType.getId() != 2L && catalogType.getId() != 3L){
				advertisementMap.put(String.valueOf(catalogType.getId()), catalogType.getName());
			}
		}
	}
	
}
